package com.etc.demo;

/**
 * @author: knowno
 * @create: 2024-09-05 13:59
 * @Version 1.0
 **/
public class TestEnc {

    public static void main(String[] args) {

        TestEnc testEnc = new TestEnc();
        testEnc.setAge(1);
        System.out.println(testEnc.getAge());

    }
    private String name;
    private int age;
    private String job;

    public TestEnc() {
    }

    public TestEnc(String name, int age, String job) {
        this.name = name;
        this.age = age;
        this.job = job;
    }

    @Override
    public String toString() {
        return "TestEnc{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", job='" + job + '\'' +
                '}';
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        if (age<1){
           // throw  new RuntimeException("年龄不能小于1！");
            age = 1;
        }
        this.age = age;
    }

    public String getJob() {
        return job;
    }

    public void setJob(String job) {
        this.job = job;
    }
}
